<template>
	<view scroll-with-animation scroll-y style="height:100vh;position: relative;background-color: #FFFFFF;padding-bottom: 40rpx;">
		<view class="list pl25 pr25" style="text-align: center;background-color: #FFFFFF;padding-top: 10rpx;" v-if="noticeList&&noticeList.length>0">
			<view class="chufang-card" v-for=" (item,idx) in noticeList" :key="item.id" @click="toxqInfo(idx)">
				<view class="chufang-card-row" style="margin-bottom: 10rpx;">
					<text style="color: #424C4C;font-size: 30rpx;font-weight: bolder;">{{item.title}}</text>
					<text style="color: #B0B0B0;">{{formatDate(item.createTime)}}</text>
				</view>
				<view style="width: calc(100% - 40rpx );text-align: left;word-break: break-all;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 4;-webkit-box-orient: vertical;">
					{{item.content}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				wx: "https://app.mzmzb.com",
				noticeList: []
			};
		},
		onLoad() {
			this.getHspNoticeList();
		},
		methods: {
			toxqInfo(val){
				let obj = this.noticeList[val]
				uni.setStorageSync("noticeInfo", obj)
				uni.navigateTo({
				    url: '/pages/gonggaoxq/index'
				});
			},
			getHspNoticeList() {
				this.func.$request('wx/getHspNoticeList.tz',{hspId: this.hspId},'GET').then(res=>{
					if (res.data.success = true) {
						this.noticeList = res.data.result
					}
					
				})
			},
			formatDate(value) {
			  var date = new Date(value);
			  var y = date.getFullYear(),
			    m = date.getMonth() + 1,
			    d = date.getDate(),
			    h = date.getHours(),
			    i = date.getMinutes(),
			    s = date.getSeconds();
			  if (m < 10) { m = '0' + m; }
			  if (d < 10) { d = '0' + d; }
			  if (h < 10) { h = '0' + h; }
			  if (i < 10) { i = '0' + i; }
			  if (s < 10) { s = '0' + s; }
			  var t = y + '-' + m + '-' + d + ' ' + h + ':' + i + ':' + s;
			  return t;
			}
		}
	};
</script>

<style lang="less">
	.list{
		.chufang-card{
			// border-top: 1rpx solid #efefef;
			border: 1px solid #F2F9F9;
			box-shadow: 0px 1px 17px 1px rgba(162, 215, 211, 0.16);
			border-radius: 32rpx;
			background-color: #FFFFFF;
			margin-top: 20rpx;
			margin-bottom: 40rpx;
			padding-left: 40rpx;
			padding-top: 30rpx;
			padding-bottom: 20rpx;
			.chufang-card-row{
				width: calc(100% - 40rpx );
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 20rpx;
			}
		}
	}
	.empty-list{
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		width: 100vw;
		height: 100vh;
		background-color: #FFFFFF;
		.btn{
			width: 320rpx;
			height: 88rpx;
			line-height: 88rpx;
			text-align: center;
			color: #FFFFFF;
			background: linear-gradient(90deg, #23E0D3 0%, #00BAAD 100%);
			box-shadow: 0px 20rpx 25rpx 0px rgba(0, 186, 173, 0.4);
			border-radius: 10rpx;
		}
	}
</style>
